<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ include file="../../../commons/taglibs.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
		<base href="<%=basePath%>">
		<title>列表</title>
		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<script type="text/javascript">
		function orderSend(){
			if ($('#list_data').datagrid('getSelected')) {
				//首先如果用户选择了数据，则获取选择的数据集合
				var selectedRow = $('#list_data').datagrid('getSelections');
				if (selectedRow.length > 1) {
					$.messager.alert('提示', '只能选择一条数据！', 'warning');
				} else {
					//url为修改时路径+当前选中的参数
					var orderId=selectedRow[0].id
					var order_status=selectedRow[0].order_status
					if(order_status=='0'){
						var url="<%=path %>/jsp/busOrder/orderSendLst.jsp?orderId="+orderId;	
						$('#orderSend').dialog('refresh', url);
				 		$('#orderSend').dialog('open'); 
					}else{
						$.messager.alert('提示', '订单已分发！')
					}
				}
			} else {
				$.messager.alert('提示', '请选择一条数据！')
			}
			
		}
		$(function(){
			loadUnCheckComBox("order_status","<%=path %>/jsp/busOrder/order_status.json")
			loadUnCheckComBox("pay_type","<%=path %>/jsp/busOrder/pay_type.json")
			
		})
		</script>
</head>
<body>

		<form id="queryForm" name="queryForm" method="post" 	>
			<div id="tab_bd1">
				<div class="title">
					<div class="left">
						查询筛选
					</div>
				</div>
				<div class="frame">
					<table width="100%" border="0" cellpadding="1" cellspacing="1" bordercolor="#CCCCCC" bgcolor="#CCCCCC" align="center">
						<tr>
							<td class="lbg" width="120">
								订单名称：
							</td>
							<td>
								<input name="busOrder.order_name" id="busOrder.order_name" type="text" size="30">
							</td>
							<td class="lbg" width="120">
								业务人：
							</td>
							<td>
								<input name="busOrder.owner" id="busOrder.owner" type="text" size="30">
							</td>
						</tr>
						<tr>
							<td class="lbg" width="120">
								付款类型：
							</td>
							<td>
								<input name="busOrder.pay_type" id="pay_type" type="text" size="30">
							</td>
							<td class="lbg" width="120">
								订单状态：
							</td>
							<td>
								<input name="busOrder.order_status" id="order_status" type="text" size="30">
							</td>
						</tr>
						<tr>
							<td class="lbg" width="60" colspan="8">
								<a id="btn" href="javascript:queryUi()" class="easyui-linkbutton" data-options="iconCls:'icon-search'">查询</a>
								<a id="btn" href="javascript:window.location.href='<%=path %>/jsp/busOrder/list.jsp'" class="easyui-linkbutton" data-options="iconCls:'icon-reload'">返回</a>
							</td>
						</tr>
					</table>
				</div>
			</div>
		</form>

		<!-- 数据集合部分 -->	
	<table id="list_data" > </table>
		
	<script type="text/javascript">
	/**  页面加载自动加载datagrid数据 **/
	$(function(){
			$('#list_data').datagrid({  
		        title:'订单列表',  
		        iconCls:'icon-edit',//图标  
		        width: 'auto',  
		        height: 'auto',  
		        nowrap: false,  
		        striped: true,  
		        border: true,  
		       loadMsg:'数据加载中请稍后……',
		        collapsible:true,//是否可折叠的  
		        fit: false,//自动大小  
		        url:'<%=path %>/busOrder/list',  
		        remoteSort:false,   
		        idField:'id',  
		        singleSelect:false,//是否单选  
		        pagination:true,//分页控件  
		        rownumbers:true,//行号  
		        columns:[[
				{field:'order_status',title:'订单状态',width:100,align:'center',formatter:function(value,row,index){
					if(row.order_status=="0"){
						return '<font color="FFD700">草稿</font>';
					}if(row.order_status=="1"){
						return '<font color="008000">已派单</font>';
					}if(row.order_status=="2"){
						return '<font color="8B0000">完结未收账</font>';
					}if(row.order_status=="3"){
						return '<font color="929292">完结</font>';
					}
				}},          
				{field:'order_name',title:'订单名称',width:120,align:'center'},
				{field:'sign_date',title:'签署时间',width:130,align:'center'},
				{field:'owner',title:'业务人',width:80,align:'center'},
				{field:'pay_type',title:'支付类型',width:80,align:'center',formatter:function(value,row,index){
					if(row.pay_type=="1"){
						return "一次性付款";
					}else if(row.pay_type=="2"){
						return "挂账";
					}else if(row.pay_type=="3"){
						return "业务人代收";
					}else{
						return "司机代收";
					}
				}},
				{field:'sum_fee',title:'总金额',width:100,align:'center'},
				{field:'per_fee',title:'垫付金额',width:100,align:'center'},
				{field:'sum_fee',title:'已收金额',width:80,align:'center'},
				{field:'sum_fee',title:'欠款金额',width:80,align:'center'},
				{field:'bus_no',title:'车牌号',width:80,align:'center'},
				{field:'driver_name',title:'司机姓名',width:80,align:'center'}
				]],
		        frozenColumns:[[  
		            {field:'id',checkbox:true}  
		        ]],  
		        toolbar: [{  
		            text: '添加',  
		            iconCls: 'icon-add',  
		            handler: function() {  
		        		openDag("<%=path %>/busOrder/beginCreate");  
		            }  
		        }, '-', {  
		            text: '修改',  
		            iconCls: 'icon-edit',  
		            handler: function() {  
		        	//beforeUpdateDialogTag('<%=path %>/batchActivity/edit.do?id=','id','岗位','<%=path %>/batchActivity/saveOrUpdate.do','','');
	        		updateDag('<%=path %>/busOrder/edit?id=','id');
		                
		            }  
		        }, '-',{  
		            text: '删除',  
		            iconCls: 'icon-remove',  
		            handler: function(){  
		                delAppInfo('<%=path %>/busOrder/delete?items=','id' );  
		            }  
		        }, '-',{  
		            text: '发放',  
		            iconCls: 'icon-redo',  
		            handler: function(){  
		                orderSend() 
		            }  
		        }]
		    });  

			var p = $('#list_data').datagrid('getPager');  
		    $(p).pagination({  
		        pageSize: 10,//每页显示的记录条数，默认为10  
		        pageList: [5,10,15],//可以设置每页记录条数的列表  
		        beforePageText: '第',//页数文本框前显示的汉字  
		        afterPageText: '页     共{pages}页',  
		        displayMsg: '当前显示 {from} - {to} 条记录   共 {total}条记录'
		    }); 
	}); 	
</script>

		<div  id="orderSend"  class="easyui-dialog" data-options="title: '订单发放',   
				    width: 720,
				    height: 300,  
				    top:70, 
				    closed: true,   
				    cache: false,   
				    modal: true  ">
		</div>

</body>	
</html>
	
